package logic

import (
	"github.com/gin-gonic/gin"
	"web_app/dao/mysql"
	"web_app/models"
	"web_app/tools/snowflake"
)

func SignUp(uq *models.UserRequest) error {
	//把请求参数转变为入库参数
	var u models.User
	u.Username = uq.Username
	u.Password = uq.Password
	u.UserId = snowflake.GenID()
	u.Email = "moren@163.com"
	err := mysql.UserCreate(&u)
	return err
}

func UserList(ctx *gin.Context) ([]models.UserBankList, error) {
	res, err := mysql.UserList(ctx)
	return res, err
}

func UserTags(ctx *gin.Context) ([]models.UserTagList, error) {
	res, err := mysql.UserTags(ctx)
	return res, err
}
